var runningSum = function(nums) {
    const result = []
    nums.reduce((sum, item, index)=>{
        result[index] = sum + item
        return sum + item
    },0)
    return result
};

console.log(runningSum([1,2,3,4]))